﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Windows.ApplicationModel.Resources;

namespace playwrightJu3.Windows
{
    /// <summary>
    /// LicenseWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LicenseWindow : Window
    {
        public LicenseWindow()
        {
            InitializeComponent();
            DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Licenses");
            foreach (FileInfo file in directoryInfo.GetFiles("*", SearchOption.TopDirectoryOnly))
            {
                string name = System.IO.Path.GetFileNameWithoutExtension(file.FullName);
                list.Items.Add(name);
            }
            list.SelectedIndex = 0;
        }

        private void list_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            license.Text = File.ReadAllText($"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}\\Licenses\\{list.SelectedItem}.txt");
        }
    }
}
